﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Linq;
using SmartCollector.Domain.Entity;

namespace SmartCollector.Domain.Repository
{
    public class ItemRepository
    {
        private Table<tbl_Item> m_items;
        //public ItemRepository()
        //{
        //    m_items = (new Entity.EntityDomainDataContext()).GetTable<tbl_Item>();
        //}
        public IQueryable<tbl_Item> Items
        {
            get
            {
                return m_items.AsQueryable();
            }
        }

        public ItemRepository()
        {
            m_items = (new EntityDomainDataContext()).GetTable<tbl_Item>();
        }

        public void AddItem(tbl_Item item)
        {
            m_items.InsertOnSubmit(item);
        }

        public void SubmitChanges()
        {
            m_items.Context.SubmitChanges();
        }
    }
}
